import React, {Component} from 'react';
import qs from 'qs';

class Detail extends Component {
  render() {
    // path 参数
    // const {id, title} = this.props.match.params
    // search 参数
    // const {id, title} = qs.parse(this.props.location.search.slice(1))
    // state 参数
    // hash模式state参数丢失问题, 解决方式 || {}
    const {id, title} = this.props.location.state || {}
    // console.log(this.props)
    return (
      <div>
        <ul>
          <li>ID: {id}</li>
          <li>标题: {title}</li>
        </ul>
      </div>
    );
  }
}

export default Detail;